﻿//========================================================= 
/**@file SSC_CmdDriver.h
 * @brief 
 * 
 * @date 2021-07-16   03:10:52
 * @author Zhyioo 
 * @version 1.0
 */ 
//--------------------------------------------------------- 
#ifndef _LIBZHOUYB_SSC_CMDDRIVER_H_
#define _LIBZHOUYB_SSC_CMDDRIVER_H_
//--------------------------------------------------------- 
#include "../CommonCmdDriver.h"

#include "../../../device/iccard/social_security_card/SocialSecurityCardAppAdapter.h"
using namespace zhou_yb::device::iccard::social_security_card;
//--------------------------------------------------------- 
namespace zhou_yb {
namespace application {
namespace driver {
//--------------------------------------------------------- 
/// 社保卡命令驱动
class SSC_CmdDriver :
    public CommonCmdDriver,
    public BaseDevAdapterBehavior<ITransceiveTrans>
{
protected:
    SocialSecurityCardAppAdapter _icAdapter;
public:
    SSC_CmdDriver() : CommonCmdDriver()
    {
        _errGetter.Add(_icAdapter);
        _logSetter.select(_icAdapter);

        _RegisteCMD(SSC_CmdDriver, GetCardNumber);
        _RegisteAdapterCMD(SSC_CmdDriver);
    }
    LC_CMD_ADAPTER_INVOKE(ITransceiveTrans, _icAdapter);
    /**
     * @brief 获取社保卡号
     * 
     * @retval CardNumber : string 获取到的卡号
     * 
     * @date 2021-07-16 03:15:26
     */
    LC_CMD_METHOD(GetCardNumber)
    {
        ByteBuilder cardNumber(8);
        if(!_icAdapter.GetCardNumber(cardNumber))
        {
            _logErr(DeviceError::OperatorErr, "获取卡号失败");
            return false;
        }
        rlt.Put("CardNumber", cardNumber.GetString());
        return true;
    }
};
//--------------------------------------------------------- 
}
}
}
//--------------------------------------------------------- 
#endif // _LIBZHOUYB_SSC_CMDDRIVER_H_
//========================================================= 